﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using TransactionServer.General_Classes;

namespace TransactionServer.OSActivities77
{

    public sealed class OSGetListValue77 : CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<Context> Context { get; set; }
        public InArgument<string> Connection { get; set; }
        public InArgument<string> List { get; set; }
        public InArgument<string> Value { get; set; }

        public OutArgument<object> ResultId { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            Context con = context.GetValue(this.Context);
            string Connection = context.GetValue(this.Connection);
            string List = context.GetValue(this.List);
            string Value = context.GetValue(this.Value);

            OSConnector77 conn = (OSConnector77)con.Connector[Connection];

            object id = conn.lookupListByValue(List, Value);

            context.SetValue(ResultId, id);
        }
    }
}
